home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 61 / Quick PC 61.iso / I386 / SASETUP.MSI / F77724_Web_MasterSettings.asp < prev    next >
Encoding:
Text File  |  2003-02-21  |  24.9 KB  |  776 lines

  1. <%@ Language=VBScript     %>
  2.  
  3. <%    Option Explicit       %>
  4.  
  5. <%
  6.     '------------------------------------------------------------------------- 
  7.     ' Web_MasterSettings.asp: Change the web master settings
  8.     '
  9.     ' Copyright (c) Microsoft Corporation.  All rights reserved. 
  10.     '
  11.     ' Date            Description    
  12.     ' 25-10-2000    Created date
  13.     ' 15-01-2001    Modified for new Framework
  14.     '-------------------------------------------------------------------------
  15. %>
  16.  
  17. <!--  #include virtual="/admin/inc_framework.asp"--->
  18. <!-- #include virtual="/admin/wsa/inc_wsa.asp" -->
  19.  
  20. <% 
  21.     '-------------------------------------------------------------------------
  22.     ' Form Variables
  23.     '-------------------------------------------------------------------------
  24.     Dim F_bASPEnabled                       'ASP enabled flag
  25.     Dim F_strWebRootDir                        'Root Dir for the form
  26.     Dim F_strAspScriptTimeout                'Script timeout for the form
  27.     Dim F_strIndexResource                    'index resource for the form
  28.     Dim F_strLimitedTo                        'Limited connections
  29.     Dim F_strMaxCon                            'Max connections for the form
  30.  
  31.     '-------------------------------------------------------------------------
  32.     ' Global Variables
  33.     '-------------------------------------------------------------------------
  34.     Dim G_objService                            'to hold the connection    
  35.     Dim G_objSites    
  36.     '-------------------------------------------------------------------------
  37.     ' Start of localization content
  38.     '-------------------------------------------------------------------------    
  39.     Dim L_WEBTASKTITLETEXT
  40.     Dim L_WEBROOTDIRTEXT
  41.     Dim L_INVALID_DIR_FORMAT_ERRORMESSAGE
  42.     Dim L_INVALID_DRIVE_ERRORMESSAGE
  43.     Dim L_ASPSCRIPT_TIMEOUTTEXT
  44.     Dim L_SECONDSTEXT
  45.     Dim L_ENABLEFPSE_RESOURCETEXT
  46.     Dim L_MAX_CONNECTIONSTEXT
  47.     Dim L_UNLIMITEDTEXT
  48.     Dim L_LIMITEDTOTEXT
  49.     Dim L_CONLIMIT_ERRORMESSAGE
  50.     Dim L_TIMEOUT_ERRORMESSAGE
  51.     Dim L_FILEINFORMATION_ERRORMESSAGE
  52.     Dim L_NOT_NTFS_DRIVE_ERRORMESSAGE
  53.     Dim L_FAILED_CREATE_DIR_ERRORMESSAGE
  54.     Dim L_INFORMATION_ERRORMESSAGE
  55.     Dim L_UNABLETOSETMASTER_ERRORMESSAGE
  56.     Dim L_UNABLETOSETROOTDIR_ERRORMESSAGE
  57.     Dim L_DIR_ERRORMESSAGE
  58.     Dim L_UNABLETOCREATE_KEY_ERRORMESSAGE
  59.     Dim L_SET_WEBROOT_VAL_FAILED_ERRORMESSAGE
  60.     Dim    L_INVALID_DIR_ERRORMESSAGE
  61.     Dim L_DIRPATHEMPTY_ERRORMESSAGE
  62.     
  63.     Dim L_ID_NOTEMPTY_ERROR_MESSAGE
  64.     Dim L_SITE_IDENTIFIER_EMPTY_TEXT
  65.     Dim L_ENABLE_ASP
  66.     
  67.     L_ENABLE_ASP                                =   GetLocString("GeneralSettings.dll", "4042005C", "")
  68.     L_WEBTASKTITLETEXT                            =    GetLocString("GeneralSettings.dll", 40420001, "")
  69.     L_WEBROOTDIRTEXT                            =    GetLocString("GeneralSettings.dll", 40420002, "")
  70.     L_INVALID_DIR_FORMAT_ERRORMESSAGE            =    GetLocString("GeneralSettings.dll", 40420004, "")
  71.     L_INVALID_DRIVE_ERRORMESSAGE                =    GetLocString("GeneralSettings.dll", "C0420022", "")
  72.     L_ASPSCRIPT_TIMEOUTTEXT                        =    GetLocString("GeneralSettings.dll", 40420005, "")
  73.     L_SECONDSTEXT                                =    GetLocString("GeneralSettings.dll", 40420006, "")    
  74.     L_ENABLEFPSE_RESOURCETEXT                    =    GetLocString("GeneralSettings.dll", 40420007, "")
  75.     L_MAX_CONNECTIONSTEXT                        =    GetLocString("GeneralSettings.dll", 40420008, "")
  76.     L_UNLIMITEDTEXT                                =    GetLocString("GeneralSettings.dll", 40420009, "")
  77.     L_LIMITEDTOTEXT                                =    GetLocString("GeneralSettings.dll", "4042000A", "")
  78.     L_CONLIMIT_ERRORMESSAGE                        =    GetLocString("GeneralSettings.dll", "C042000B", "")
  79.     L_TIMEOUT_ERRORMESSAGE                        =    GetLocString("GeneralSettings.dll", "C0420051", "")
  80.     L_FILEINFORMATION_ERRORMESSAGE                =    GetLocString("GeneralSettings.dll", "C042000C", "")
  81.     L_NOT_NTFS_DRIVE_ERRORMESSAGE                =    GetLocString("GeneralSettings.dll", "C042000D", "")
  82.     L_FAILED_CREATE_DIR_ERRORMESSAGE            =    GetLocString("GeneralSettings.dll", "C042000E", "")
  83.     L_INFORMATION_ERRORMESSAGE                    =    GetLocString("GeneralSettings.dll", "C042000F", "")
  84.     L_UNABLETOSETMASTER_ERRORMESSAGE            =    GetLocString("GeneralSettings.dll", "C0420010", "")
  85.     L_UNABLETOSETROOTDIR_ERRORMESSAGE            =    GetLocString("GeneralSettings.dll", "C0420011", "")
  86.     L_DIR_ERRORMESSAGE                            =    GetLocString("GeneralSettings.dll", "C0420012", "")
  87.     L_UNABLETOCREATE_KEY_ERRORMESSAGE            =    GetLocString("GeneralSettings.dll", "C0420018", "")
  88.     L_SET_WEBROOT_VAL_FAILED_ERRORMESSAGE        =    GetLocString("GeneralSettings.dll", "C0420019", "")
  89.     L_INVALID_DIR_ERRORMESSAGE                    =    GetLocString("GeneralSettings.dll", "C042004B", "")
  90.     L_DIRPATHEMPTY_ERRORMESSAGE                    =    GetLocString("GeneralSettings.dll", "C042004C", "")
  91.     '-------------------------------------------------------------------------
  92.     'END of localization content
  93.     '-------------------------------------------------------------------------
  94.     'Create property page
  95.     Dim rc
  96.     Dim page
  97.  
  98.     rc=SA_CreatePage(L_WEBTASKTITLETEXT,"",PT_PROPERTY,page)
  99.    
  100.     'Serve the page
  101.     If(rc=0) then
  102.         SA_ShowPage(Page)
  103.     End if
  104.         
  105.     '-------------------------------------------------------------------------
  106.     'Function:                OnInitPage()
  107.     'Description:            Called to signal first time processing for this page.
  108.     '                        Use this method to do first time initialization tasks
  109.     'Input Variables:        PageIn,EventArg
  110.     'Output Variables:        None
  111.     'Returns:                True/False
  112.     'Global Variables:        None
  113.     '-------------------------------------------------------------------------
  114.     Public Function OnInitPage(ByRef PageIn,ByRef EventArg)
  115.         InitObjects()
  116.         SetVariablesFromSystem()
  117.         OnInitPage = True
  118.     End Function
  119.     
  120.     '-------------------------------------------------------------------------
  121.     'Function:                OnServePropertyPage()
  122.     'Description:            Called when the page needs to be served.Use this 
  123.     '                        method to serve content
  124.     'Input Variables:        PageIn,EventArg
  125.     'Output Variables:        None
  126.     'Returns:                True/False
  127.     'Global Variables:        None
  128.     '-------------------------------------------------------------------------
  129.     Public Function OnServePropertyPage(ByRef PageIn,Byref EventArg)
  130.         Call ServeCommonJavaScript()
  131.         Call ServePage()
  132.         OnServePropertyPage = True
  133.     End Function
  134.     
  135.     '-------------------------------------------------------------------------
  136.     'Function:                OnPostBackPage()
  137.     'Description:            Called to signal that the page has been posted-back.
  138.     'Input Variables:        PageIn,EventArg
  139.     'Output Variables:        None
  140.     'Returns:                True/False
  141.     'Global Variables:        None
  142.     '-------------------------------------------------------------------------
  143.     Public Function OnPostBackPage(ByRef PageIn ,ByRef EventArg)
  144.         OnPostBackPage = True
  145.     End Function
  146.         
  147.     '-------------------------------------------------------------------------
  148.     'Function:                OnSubmitPage()
  149.     'Description:            Called when the page has been submitted for processing.
  150.     '                        Use this method to process the submit request.
  151.     'Input Variables:        PageIn,EventArg
  152.     'Output Variables:        None
  153.     'Returns:                True/False
  154.     'Global Variables:        None
  155.     '-------------------------------------------------------------------------
  156.     Public Function OnSubmitPage(ByRef PageIn ,ByRef EventArg)
  157.         OnSubmitPage = ServeVariablesFromForm()
  158.     End Function
  159.            
  160.     '-------------------------------------------------------------------------
  161.     'Function:                OnClosePage()
  162.     'Description:            Called when the page is about closed.Use this method
  163.     '                        to perform clean-up processing
  164.     'Input Variables:        PageIn,EventArg
  165.     'Output Variables:        None
  166.     'Returns:                True/False
  167.     'Global Variables:        None
  168.     '-------------------------------------------------------------------------
  169.     Public Function OnClosePage(ByRef PageIn ,ByRef EventArg)
  170.         OnClosePage = TRUE
  171.     End Function     
  172.     
  173.     '-------------------------------------------------------------------------
  174.     'Function:                ServeCommonJavaScript
  175.     'Description:            Serves in initialiging the values,setting the form
  176.     '                        data and validating the form values
  177.     'Input Variables:        None
  178.     'Output Variables:        None
  179.     'Returns:                True/False
  180.     'Global Variables:        None
  181.     '-------------------------------------------------------------------------
  182.     Function ServeCommonJavaScript()
  183. %>        
  184.     <!-- #include virtual="/admin/wsa/inc_wsa.js" -->
  185.     <!-- #include file="inc_MasterWeb.js" -->
  186.     
  187.         <script language="JavaScript" >    
  188.             
  189.             //Validates connection limit
  190.  
  191.             function ValidatePage()
  192.             { 
  193.                 // validate functions
  194.                  var temp = document.frmTask.optMaxCon[1].checked;
  195.                  var temp1 = document.frmTask.txtLimitedTo.value;
  196.                  if(temp==true && temp1=="" )
  197.                  {                 
  198.                     SA_DisplayErr("<%=Server.HTMLEncode(SA_EscapeQuotes(L_CONLIMIT_ERRORMESSAGE))%>");
  199.                     document.frmTask.txtLimitedTo.focus();
  200.                     return false;
  201.                  }
  202.                  
  203.                  var strTimeOut = document.frmTask.txtAspScriptTimeout.value;
  204.                  if(strTimeOut=="" || strTimeOut==0 )
  205.                  {                 
  206.                     SA_DisplayErr("<%=Server.HTMLEncode(SA_EscapeQuotes(L_TIMEOUT_ERRORMESSAGE))%>");
  207.                     document.frmTask.txtAspScriptTimeout.focus();
  208.                     return false;
  209.                  }
  210.                  
  211.                  var strDirField = document.frmTask.txtWebRootDir.value;
  212.                  if(strDirField == "")
  213.                  {
  214.                      SA_DisplayErr("<%=Server.HTMLEncode(SA_EscapeQuotes(L_DIR_ERRORMESSAGE))%>");
  215.                     return false;
  216.                  }
  217.                  else
  218.                  {
  219.                     
  220.                      var nRetVal = strDirField.indexOf(":\\");
  221.                      var nRetVal1 = strDirField.indexOf("//");
  222.                      var nRetVal2 = strDirField.indexOf("\\\\");
  223.                      if (nRetVal== -1 || nRetVal1 > 0 || nRetVal2 > 0)
  224.                      {
  225.                         SA_DisplayErr("<%=Server.HTMLEncode(SA_EscapeQuotes(L_INVALID_DIR_FORMAT_ERRORMESSAGE))%>");
  226.                         return false;
  227.                      }    
  228.                  }    
  229.                 
  230.                 var strID = "";
  231.                 strID = document.frmTask.txtWebRootDir.value;
  232.             
  233.                 var strIndex = strID.indexOf("\\\\");
  234.                 if (strIndex > 0)
  235.                 {
  236.                     SA_DisplayErr("<%=Server.HTMLEncode(SA_EscapeQuotes(L_INVALID_DIR_FORMAT_ERRORMESSAGE))%>");
  237.                     document.frmTask.txtWebRootDir.focus();
  238.                     return false;
  239.                 }
  240.                             
  241.                         
  242.                 // validate site directory                 
  243.                 if (!(checkKeyforValidCharacters(strID)))
  244.                         return false;
  245.                         
  246.                 var strMaxCon = document.frmTask.txtLimitedTo.value;
  247.                 var ChktxtLimitedTo = document.frmTask.optMaxCon[1].checked;
  248.                 if(ChktxtLimitedTo == true) 
  249.                 {
  250.                     if (strMaxCon == 0 || strMaxCon == "" )
  251.                     {                        
  252.                         SA_DisplayErr("<%=Server.HTMLEncode(SA_EscapeQuotes(L_CONLIMIT_ERRORMESSAGE))%>");
  253.                         document.frmTask.txtLimitedTo.focus();
  254.                         return false;
  255.                     }
  256.                         
  257.                 }                         
  258.              
  259.                     UpdateHiddenVariables();
  260.                     return true;
  261.                     
  262.                 return true;
  263.             }
  264.             
  265.             
  266.             function checkKeyforValidCharacters(strID)
  267.             {    
  268.                             
  269.                 var len = strID.length;
  270.                 var charAtPos;
  271.                 if(len > 0)
  272.                 {        
  273.                     for(var i=0; i<len;i++)
  274.                     {
  275.                       charAtPos = strID.charCodeAt(i);                        
  276.                         if(charAtPos ==47 || charAtPos == 42 || charAtPos == 63 || charAtPos == 34 || charAtPos == 60 || charAtPos == 62 || charAtPos == 124 || charAtPos == 91 || charAtPos == 93 || charAtPos == 59 || charAtPos == 43 || charAtPos == 61 || charAtPos == 44)
  277.                         {    
  278.                             SA_DisplayErr("<%=Server.HTMLEncode(SA_EscapeQuotes(L_INVALID_DIR_ERRORMESSAGE))%>");
  279.                             document.frmTask.txtWebRootDir.value = strID;
  280.                             document.frmTask.txtWebRootDir.focus();
  281.                             return false;
  282.                         }
  283.                     }                
  284.                     return true;
  285.                 }
  286.                 else 
  287.                 {    
  288.                     SA_DisplayErr("<%=Server.HTMLEncode(SA_EscapeQuotes(L_DIRPATHEMPTY_ERRORMESSAGE))%>");
  289.                     document.frmTask.txtWebRootDir.focus();
  290.                     return false;
  291.                 }             
  292.             }        
  293.             
  294.             
  295.             
  296.             //init function  
  297.             function Init() 
  298.             {   
  299.             }
  300.             
  301.             function UpdateHiddenVariables()
  302.             {
  303.             
  304.                 //document.frmTask.hdnASPEnabled.value = document.frmTask.chkASPEnabled.checked;
  305.                 document.frmTask.hdnWebRootDir.value = document.frmTask.txtWebRootDir.value;
  306.                 document.frmTask.hdnIndex.value = document.frmTask.chkIndexResource.checked;
  307.             }
  308.             //sets the data
  309.             function SetData()
  310.             {                                    
  311.                 UpdateHiddenVariables();
  312.             }    
  313.             
  314.             function checkforEmptyfield()
  315.             {
  316.                 var strScriptTimeOut = document.frmTask.txtAspScriptTimeout.value; 
  317.                 if (strScriptTimeOut == "" || strScriptTimeOut == 0)
  318.                     document.frmTask.txtAspScriptTimeout.value = 1;            
  319.                 
  320.                 var strMaxCon = document.frmTask.txtLimitedTo.value;
  321.                 var ChktxtLimitedTo = document.frmTask.optMaxCon[1].checked;
  322.                 if(ChktxtLimitedTo == true) 
  323.                 {
  324.                     //if (strMaxCon == "" || strMaxCon == 0)
  325.                     if (strMaxCon == "" || strMaxCon < 2)
  326.                         document.frmTask.txtLimitedTo.value = 2;
  327.                 }    
  328.             }
  329.             
  330.             
  331.             // Enable ASP clicked
  332.             //function EnableASP()
  333.             //{    
  334.             //    EnableOK();                                
  335.                 
  336.             //    if ( document.frmTask.chkASPEnabled.checked == false )
  337.             //    {                        
  338.             //        document.frmTask.txtAspScriptTimeout.disabled = true;                    
  339.             //    }
  340.             //    else
  341.             //    {        
  342.             //        document.frmTask.txtAspScriptTimeout.disabled = false;                                        
  343.             //    }                
  344.             // }
  345.         
  346.         </script>
  347. <%    End Function
  348.    
  349.     '-------------------------------------------------------------------------
  350.     'Function:                ServePage()
  351.     'Description:            For displaying outputs HTML to the user
  352.     'Input Variables:        None    
  353.     'Output Variables:        None
  354.     'Returns:                None
  355.     'Global Variables:        L_DELETE_CONFIRM_TEXT
  356.     '-------------------------------------------------------------------------
  357.     Function ServePage
  358. %>
  359.         <TABLE WIDTH=600 VALIGN=middle ALIGN=left BORDER=0 CELLSPACING=0 
  360.         CELLPADDING=2 class="TasksBody">
  361.                 <TR>
  362.                     <TD>
  363.                          
  364.                     </TD>
  365.                     <TD>                
  366.                          
  367.                     </TD>
  368.                 </TR>            
  369.                 <TR>
  370.                     <TD>
  371.                         <%=L_WEBROOTDIRTEXT %>
  372.                     </TD>
  373.                     <TD>
  374.                          <INPUT TYPE=TEXT NAME=txtWebRootDir class="formField" tabIndex=1 VALUE="<%=F_strWebRootDir%>" SIZE=30 TABINDEX=1 onKeyPress = "ClearErr()">
  375.                     </TD>
  376.                 </TR>
  377.  
  378.                 <TR>
  379.                     <TD>
  380.                          
  381.                     </TD>
  382.                     <TD>                
  383.                          
  384.                     </TD>
  385.                 </TR>            
  386.                 <TR>
  387.                     <TD>
  388.                         <%=L_ASPSCRIPT_TIMEOUTTEXT%>
  389.                     </TD>
  390.                     <TD>
  391.                     
  392.                          <INPUT TYPE=TEXT NAME=txtAspScriptTimeout class="formField" tabIndex=6 VALUE="<%=Server.HTMLEncode(F_strAspScriptTimeout)%>" SIZE=30 TABINDEX=2 OnKeyUP="javaScript:checkUserLimit(this,'scripttimeout');" OnKeypress="javaScript:checkKeyforNumbers(this);" onblur = "checkforEmptyfield();"> 
  393.                     
  394.                     </TD>
  395.                 </TR>
  396.                 <TR>
  397.                     <TD>
  398.                          
  399.                     </TD>
  400.                     <TD>                
  401.                          
  402.                     </TD>
  403.                 </TR>            
  404.                 <TR>
  405.                     <TD>
  406.                         <% if F_strIndexResource = true then%>                                     
  407.                             <INPUT TYPE=checkbox NAME=chkIndexResource class="formField" checked tabIndex=7 VALUE="<%=F_strIndexResource%>" >
  408.                         <% else %>
  409.                             <INPUT TYPE=checkbox NAME=chkIndexResource class="formField" tabIndex=7 VALUE="<%=F_strIndexResource%>" >
  410.                         <% end if %>
  411.                            <%=L_ENABLEFPSE_RESOURCETEXT%>
  412.                     </TD>                
  413.                 </TR>
  414.                 
  415.                 <TR>
  416.                     <TD>
  417.                          
  418.                     </TD>
  419.                     <TD>                
  420.                          
  421.                     </TD>
  422.                 </TR>
  423.                 <TR>
  424.                     <TD>
  425.                         <%=L_MAX_CONNECTIONSTEXT%>
  426.                     </TD>
  427.                     <TD>
  428.                     <% if F_strMaxCon = L_UNLIMITEDTEXT then %>
  429.                         <INPUT TYPE=radio NAME=optMaxCon onclick = "txtLimitedTo.disabled = true; txtLimitedTo.value = '';" tabIndex=8 checked class="formField" VALUE="<%=L_UNLIMITEDTEXT%>" ><%=L_UNLIMITEDTEXT%>
  430.                     <%else%>
  431.                         <INPUT TYPE=radio NAME=optMaxCon onclick = "txtLimitedTo.disabled = true; txtLimitedTo.value = '';" tabIndex=8 class="formField" VALUE="<%=L_UNLIMITEDTEXT%>" ><%=L_UNLIMITEDTEXT%>
  432.                     <%end if%>
  433.                     </TD>
  434.                 </TR>            
  435.                 <TR>
  436.                     <TD>                
  437.                     </TD>
  438.                     <TD>
  439.                     <% if F_strMaxCon = L_LIMITEDTOTEXT then %>
  440.                         <INPUT TYPE=radio NAME=optMaxCon checked class="formField" VALUE="<%=L_LIMITEDTOTEXT%>" tabIndex=9 onclick = "txtLimitedTo.disabled = false; txtLimitedTo.focus();"><%=L_LIMITEDTOTEXT%>
  441.                           <INPUT TYPE=TEXT NAME=txtLimitedTo class="formField" tabIndex=10 VALUE="<%=F_strLimitedTo%>" SIZE=30 OnKeyUP="javaScript:checkUserLimit(this,'con');" onblur = "checkforEmptyfield();" OnKeypress="javaScript:checkKeyforNumbers(this);">
  442.                     <%else%>
  443.                         <INPUT TYPE=radio NAME=optMaxCon class="formField" VALUE="<%=L_LIMITEDTOTEXT%>" tabIndex=9 onclick = "txtLimitedTo.disabled = false;txtLimitedTo.focus();"><%=L_LIMITEDTOTEXT%>
  444.                           <INPUT TYPE=TEXT NAME=txtLimitedTo disabled class="formField" onblur = "checkforEmptyfield();" tabIndex=10 VALUE="<%=F_strLimitedTo%>" SIZE=30 OnKeyUP="javaScript:checkUserLimit(this,'con');" OnKeypress="javaScript:checkKeyforNumbers(this);">
  445.                     <%end if%>
  446.                     </TD>
  447.                 </TR>
  448.         </TABLE>
  449.         
  450.         <input type=hidden name="hdnWebRootDir" value="<%=F_strWebRootDir%>">
  451.         <input type=hidden name="hdnIndex" >
  452.         <input type=hidden name="hdnASPEnabled" >  
  453.         
  454. <%                
  455.     End Function
  456.     
  457.     '-------------------------------------------------------------------------
  458.     'Function name:            ServeVariablesFromForm()
  459.     'Description:            Serves in getting the data from Client 
  460.     'Input Variables:        None    
  461.     'Output Variables:        None
  462.     'Returns:                True/False
  463.     'Global Variables:        None
  464.     '-------------------------------------------------------------------------
  465.     Function ServeVariablesFromForm
  466.     
  467.         'setting the form variables
  468.         F_strWebRootDir =  Request.Form("txtWebRootDir")
  469.         F_strAspScriptTimeout  =  Request.Form("txtAspScriptTimeout")
  470.         F_strIndexResource  = Request.Form("hdnIndex")
  471.         F_strMaxCon = Request.Form("optMaxCon")
  472.         F_strLimitedTo = Request.Form("txtLimitedTo")
  473.         F_bASPEnabled = Request.Form("hdnASPEnabled")        
  474.         
  475.         'set the master settings
  476.         If ConfigWebServer()then
  477.            ServeVariablesFromForm = true
  478.         else
  479.             ServeVariablesFromForm = false
  480.         end if    
  481.  
  482.     End Function    
  483.  
  484.     '-------------------------------------------------------------------------
  485.     'Function name:            InitObjects
  486.     'Description:            Initialization of global variables is done
  487.     'Input Variables:        None
  488.     'Returns:                true/false
  489.     '--------------------------------------------------------------------------
  490.     
  491.     Function InitObjects()
  492.         on error resume next
  493.     
  494.         ' Get instances of IIS_WebServiceSetting that are visible throughout
  495.         Set G_objService = getWMIConnection(CONST_WMI_IIS_NAMESPACE)
  496.     
  497.         Set G_objSites = G_objService.InstancesOf(GetIISWMIProviderClassName("IIS_WebServiceSetting"))
  498.         if Err.number <> 0 or G_objSites.count = 0 then
  499.             SetErrMsg L_INFORMATION_ERRORMESSAGE
  500.             Call SA_TraceOut("WEB_MASTERSETTINGS", "InitObjects() encountered error: "+ CStr(Hex(Err.Number)))
  501.         end if
  502.         
  503.     End Function
  504.     
  505.     '-------------------------------------------------------------------------
  506.     'Function name:            ConfigWebServer
  507.     'Description:            sets the  web site root dir and also sets index resource,
  508.     '                        connection limit and other properties.
  509.     'Input Variables:        None
  510.     'Returns:                true/false
  511.     'Global variables:        None
  512.     'Other functions used:  SetWebSiteRootVal
  513.     '-------------------------------------------------------------------------
  514.     
  515.     Function ConfigWebServer()
  516.         on error resume next
  517.         err.clear
  518.                         
  519.         ConfigWebServer = false        
  520.                             
  521.         if ValidateInputs = FALSE then
  522.             SA_TraceOut "web_mastersettings", "Validate inputs failed"
  523.             exit function
  524.         end if
  525.  
  526.         if NOT SetWebSiteRootVal(F_strWebRootDir) then
  527.             SetErrMsg L_UNABLETOSETROOTDIR_ERRORMESSAGE
  528.             SA_TraceOut "web_mastersettings", "Unable to set the root directory value to the registry "
  529.             exit function
  530.         end if
  531.         
  532.         if NOT SetWebMasterSettings() then 
  533.             SetErrMsg L_UNABLETOSETMASTER_ERRORMESSAGE
  534.             SA_TraceOut "web_mastersettings", "Unable to set the Web master settings"
  535.             exit function
  536.         end if
  537.  
  538.         ConfigWebServer = true        
  539.         
  540.         'Release the object
  541.         set G_objSites = nothing
  542.         set G_objService = nothing
  543.         
  544.     end function    
  545.     
  546.     
  547.     '-------------------------------------------------------------------------
  548.     'Function name:            ValidateInputs
  549.     'Description:            Check whether directory exists
  550.     '                        If directory does not exist, create the web site if the drive letter is valid
  551.     '                        else give error message
  552.     'Input Variables:        None
  553.     'Returns:                true/false
  554.     'Global variables:        None
  555.     '-------------------------------------------------------------------------
  556.     
  557.     Function ValidateInputs
  558.         on error resume next
  559.         err.clear
  560.         
  561.         Dim  objFso
  562.         Dim nRetVal
  563.         
  564.         ValidateInputs = FALSE
  565.     
  566.         Set objFso = server.CreateObject("Scripting.FileSystemObject")
  567.         if Err.number <> 0 then
  568.             SetErrMsg L_FILEINFORMATION_ERRORMESSAGE
  569.             exit function
  570.         end if            
  571.         
  572.         nRetVal = CreateSitePath( objFso, F_strWebRootDir )
  573.         
  574.     
  575.         if nRetVal <> CONST_SUCCESS then
  576.     
  577.             if nRetVal = CONST_INVALID_DRIVE then
  578.     
  579.                 SetErrMsg L_INVALID_DRIVE_ERRORMESSAGE
  580.     
  581.             elseif nRetVal = CONST_NOTNTFS_DRIVE then
  582.     
  583.                 SetErrMsg L_NOT_NTFS_DRIVE_ERRORMESSAGE
  584.                     
  585.             else
  586.  
  587.                 SetErrMsg L_FAILED_CREATE_DIR_ERRORMESSAGE
  588.  
  589.             end if
  590.  
  591.             exit Function
  592.  
  593.         end if
  594.         
  595.  
  596.         'release the object
  597.         set objFso = nothing
  598.  
  599.         ValidateInputs = TRUE
  600.  
  601.     End Function
  602.     
  603.     
  604.     '-------------------------------------------------------------------------
  605.     'Function name:            SetWebMasterSettings
  606.     'Description:            sets the Master settings to the Master Web
  607.     'Input Variables:        None
  608.     'Returns:                true/false
  609.     'Global variables:        None
  610.     '-------------------------------------------------------------------------
  611.         
  612.     Function SetWebMasterSettings()
  613.         on error resume next
  614.         err.clear
  615.             
  616.         Dim inst
  617.         Dim objService
  618.         Dim objSites
  619.         
  620.         Set objService = getWMIConnection(CONST_WMI_IIS_NAMESPACE)
  621.  
  622.         Set objSites = objService.InstancesOf(GetIISWMIProviderClassName("IIS_WebServiceSetting"))
  623.  
  624.         if Err.number <> 0 or objSites.count = 0 then
  625.             SetErrMsg L_INFORMATION_ERRORMESSAGE
  626.             Call SA_TraceOut("WEB_MASTERSETTINGS", "InitObjects() encountered error: "+ CStr(Hex(Err.Number)))
  627.         end if
  628.         
  629.         SetWebMasterSettings = false    
  630.                         
  631.         for each inst in objSites
  632.             
  633.             inst.AspScriptTimeout = clng(F_strAspScriptTimeout)
  634.                                 
  635.             call SetFPSEOption(F_strIndexResource)
  636.             
  637.             'to set maximum connections
  638.             select case F_strMaxCon    
  639.                 case L_UNLIMITEDTEXT
  640.                     
  641.                     'In IIS 6.0, -1 indicates unlimited connections
  642.  
  643.                     if IsIIS60Installed() Then
  644.                         inst.Maxconnections = -1
  645.                     Else
  646.                         inst.Maxconnections = 2000000000
  647.                     End If
  648.  
  649.                 case else
  650.                     inst.Maxconnections = clng(F_strLimitedTo)
  651.             end select
  652.     
  653.             inst.put_(WBEMFLAG)
  654.  
  655.             if Err.number <> 0 then
  656.                 SetErrMsg L_UNABLETOSETMASTER_ERRORMESSAGE
  657.                 SA_TraceOut "web_mastersettings", "Unable to set the Web master settings"
  658.                 exit function
  659.             end if
  660.     
  661.             SetWebMasterSettings = true            
  662.             exit for
  663.         Next
  664.         
  665.         SetWebMasterSettings = true
  666.         
  667.         'Release the objects
  668.         set objService = nothing
  669.         set objSites = nothing
  670.     End Function
  671.     
  672.     
  673.     '-------------------------------------------------------------------------
  674.     'Function name:            SetWebSiteRootVal
  675.     'Description:            sets the web site root dir
  676.     'Input Variables:        strWebRootDir
  677.     'Returns:                true/false
  678.     'Global variables:        None
  679.     '--------------------------------------------------------------------------
  680.  
  681.     Function SetWebSiteRootVal(strWebRootDir)
  682.         on error resume next        
  683.         Err.clear
  684.  
  685.         Dim IRC
  686.         Dim objGetHandle
  687.         Dim rtnCreateKey
  688.  
  689.         SetWebSiteRootVal = FALSE
  690.                 
  691.         set objGetHandle = RegConnection()
  692.         
  693.         rtnCreateKey = RegCreateKey(objGetHandle,CONST_WEBBLADES_REGKEY)
  694.         IRC = objGetHandle.SetStringValue(G_HKEY_LOCAL_MACHINE,CONST_WEBBLADES_REGKEY,CONST_WEBSITEROOT_REGVAL,strWebRootDir)        
  695.         If Err.number <> 0 then
  696.             SA_TraceOut "FTP_Master Settings", L_SET_WEBROOT_VAL_FAILED_ERRORMESSAGE
  697.             SetErrMsg L_SET_WEBROOT_VAL_FAILED_ERRORMESSAGE
  698.             exit function
  699.         end if
  700.  
  701.         SetWebSiteRootVal = TRUE
  702.         
  703.         'Release the object
  704.         set objGetHandle = nothing
  705.  
  706.     End Function
  707.     
  708.     '-------------------------------------------------------------------------
  709.     'Function name:            SetVariablesFromSystem
  710.     'Description:            Serves in Getting the data from Client 
  711.     'Input Variables:        None    
  712.     'Output Variables:        None
  713.     'Returns:                None
  714.     'Global Variables:        G_objSites
  715.     '-------------------------------------------------------------------------
  716.     
  717.     Function SetVariablesFromSystem()
  718.         Err.Clear
  719.         on error resume next
  720.     
  721.         Dim nRetval
  722.         Dim inst
  723.         Dim rtnDriveInitialze 
  724.         Dim strDriveLetter
  725.  
  726.         'Getting values from system
  727.         nRetval = GetWebSiteRootVal(F_strWebRootDir)
  728.         
  729.         if nRetval <> CONST_SUCCESS then
  730.             SA_TraceOut "web_mastersettings", "failed to get the web root dir val"
  731.             if NOT GetDefWebRootVal(F_strWebRootDir) then
  732.                 SetErrMsg L_FAIL_TO_GET_WEBSITEROOT_DIR
  733.             end if
  734.         end if
  735.                     
  736.         for each inst in G_objSites
  737.             if inst.Name = "W3SVC" then                
  738.                 select case inst.Logtype
  739.                     case 1
  740.                         F_strLogDeny = "true"
  741.                     case else
  742.                         F_strLogDeny = "false"
  743.                 end select
  744.             end if
  745.         next 
  746.  
  747.         
  748.             
  749.         for each inst in G_objSites            
  750.                 
  751.             F_strAspScriptTimeout = inst.AspScriptTimeout            
  752.             
  753.             F_strIndexResource = GetFPSEOption()
  754.                 
  755.             select case inst.Maxconnections
  756.  
  757.                 'In IIS 6.0, -1 indicates unlimited connections
  758.                 case -1
  759.                     if IsIIS60Installed() Then
  760.                         F_strMaxCon = L_UNLIMITEDTEXT
  761.                     End If
  762.                 case 2000000000
  763.                     F_strMaxCon = L_UNLIMITEDTEXT
  764.                 case else
  765.                     F_strMaxCon = L_LIMITEDTOTEXT
  766.                     F_strLimitedTo = inst.Maxconnections
  767.             end select
  768.         Next
  769.         
  770.     End Function
  771.     
  772.     
  773.  
  774. %>
  775.  
  776.